const goodsModel = require("../models/repair_model");



function getrepair(goods, onRetGot, onErrGot) {
    goodsModel.selectrepair(goods, (ret) => onRetGot({ret,code:200,total:""}), (err) => onErrGot({ err ,code:400}));
    
}




function addrepair(goods, onRetGot, onErrGot) {
    console.log("goods2",goods);
    goodsModel.addrepair(goods,(ret)=>onRetGot({ret,code:200}),(err)=>onErrGot({err,code:400}))
}

function deleterepair(goods, onRetGot, onErrGot) {
    goodsModel.deleterepair(goods, (ret) => onRetGot({ret,code:200}), (err) => onErrGot({ err ,code:400}));
    
}

function updaterepair(goods, onRetGot, onErrGot) {
    console.log(goods);
    goodsModel.updaterepair(goods, (ret) => onRetGot({ret,code:200}), (err) => onErrGot({ err ,code:400}));
    
}
function getlist(goods, onRetGot, onErrGot) {
    goodsModel.list(goods, (ret) => onRetGot({ret,code:200,total:""}), (err) => onErrGot({ err ,code:400}));
    
}

const userController = {
    getrepair,
    deleterepair,
    addrepair,
    updaterepair,
    getlist
};
module.exports = userController;